* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', 'SimSun', serif;
    background: #f5f0e5 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" opacity="0.05"><path d="M0,0 L200,200 M200,0 L0,200" stroke="%23755" stroke-width="1"/></svg>');
    color: #333;
    line-height: 1.8;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 252, 245, 0.95);
    border: 1px solid #d9c7a6;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 95vh;
}

/* 顶部装饰 */
.header-decoration {
    height: 10px;
    background: linear-gradient(90deg, #8B0000, #B22222, #8B0000);
    margin-bottom: 10px;
}

header {
    text-align: center;
    padding: 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="20" viewBox="0 0 100 20"><path d="M0,10 Q25,0 50,10 T100,10" fill="none" stroke="%23d9c7a6" stroke-width="0.5"/></svg>') center bottom repeat-x;
}

h1 {
    font-size: 2.8rem;
    color: #8B0000;
    margin-bottom: 10px;
    font-weight: normal;
    letter-spacing: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2rem;
    color: #5c3e1e;
    font-style: italic;
    margin-bottom: 15px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.btn {
    background: #8B0000;
    color: #f9f3e5;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    background: #B22222;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.btn.active {
    background: #5c3e1e;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 600px;
    padding: 0 20px 20px;
    gap: 20px;
}

.category-sidebar {
    width: 220px;
    background: rgba(249, 243, 229, 0.8);
    border: 1px solid #e0d5c0;
    border-radius: 5px;
    padding: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.category-title {
    text-align: center;
    color: #8B0000;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #d9c7a6;
    font-size: 1.3rem;
}

.category-list {
    list-style: none;
}

.category-item {
    margin-bottom: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    color: #5c3e1e;
    font-weight: bold;
    position: relative;
}

.category-item:hover {
    background: rgba(139, 0, 0, 0.1);
}

.category-item.active {
    background: #8B0000;
    color: #fff;
}

.poem-list {
    list-style: none;
    margin-top: 10px;
    padding-left: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.category-item.active .poem-list {
    max-height: 500px;
}

.poem-item {
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poem-item:hover {
    background: rgba(139, 0, 0, 0.1);
}

.poem-item.active {
    background: #B22222;
    color: #fff;
}

.content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.poem-intro {
    padding: 20px;
    background: rgba(249, 243, 229, 0.8);
    border: 1px solid #e0d5c0;
    border-radius: 5px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.intro-title {
    color: #8B0000;
    font-size: 1.3rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #d9c7a6;
}

.intro-content {
    line-height: 1.8;
    color: #5c3e1e;
    font-size: 1.05rem;
}

.poem-panels {
    display: flex;
    gap: 20px;
    flex: 1;
}

.chinese-panel, .english-panel {
    flex: 1;
    padding: 20px;
    border: 1px solid #e0d5c0;
    border-radius: 5px;
    background: rgba(255, 253, 248, 0.7);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #d9c7a6;
}

.panel-title {
    color: #8B0000;
    font-size: 1.4rem;
    font-weight: normal;
}

.english-title {
    font-size: 1.1rem;
    color: #B22222;
    font-style: italic;
    font-family: 'Georgia', serif;
}

.poem-content {
    flex: 1;
    font-size: 1.1rem;
    line-height: 2.0;
    overflow-y: auto;
    padding: 10px;
}

.chinese-content {
    text-align: center;
}

.chinese-char {
    font-size: 1.8rem;
    position: relative;
    display: inline-block;
    vertical-align: top;
    transition: all 0.2s ease;
    padding: 0 2px;
    /* 为注音预留空间 */
    margin-top: 1.2em;
    padding-bottom: 0.2em;
}

/* 为有注释的文字添加下划线 */
.chinese-char.has-translation {
    border-bottom: 1px dashed #8B0000;
    cursor: pointer;
}

.chinese-char:hover {
    background: rgba(139, 0, 0, 0.1);
    border-radius: 3px;
}

/* 注音容器 */
.pinyin-container {
    position: absolute;
    top: -1.2em; /* 上移注音位置 */
    left: 0;
    width: 100%;
    text-align: center;
    height: 1.2em;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.pinyin {
    font-size: 0.8rem; /* 增大注音字号 */
    color: #B22222;
    font-family: Arial, sans-serif;
    line-height: 1;
    font-weight: bold;
    white-space: nowrap;
}

/* 标点符号样式 */
.chinese-punctuation {
    vertical-align: baseline;
    font-size: 1.8rem;
    margin: 0 2px;
    position: relative;
    top: 0.1em; /* 微调位置 */
}

.english-content {
    font-size: 1.05rem;
    text-align: left;
    line-height: 1.8;
    font-family: 'Georgia', serif;
    color: #333;
}

.english-word {
    cursor: pointer;
    position: relative;
    display: inline-block;
    padding: 0 2px;
    transition: all 0.2s ease;
    border-bottom: 1px dashed rgba(139, 0, 0, 0.3);
}

.english-word:hover {
    background: rgba(139, 0, 0, 0.1);
    border-radius: 3px;
}

.translation-popup {
    position: absolute;
    background: #8B0000;
    color: #fff;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.95rem;
    z-index: 100;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -100%);
    top: -10px;
    left: 50%;
    white-space: nowrap;
    font-family: 'Noto Serif SC', serif;
}

.translation-popup:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #8B0000;
}

footer {
    text-align: center;
    padding: 20px;
    color: #5c3e1e;
    font-size: 0.9rem;
    border-top: 1px solid #e0d5c0;
    margin-top: 10px;
}

.poem-info {
    text-align: center;
    margin: 10px 0;
    color: #8B0000;
    font-size: 1.1rem;
}

.category-icon {
    margin-right: 8px;
}

@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
    }
    
    .category-sidebar {
        width: 100%;
    }
    
    .poem-panels {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
        letter-spacing: 4px;
    }
    
    .chinese-char, .chinese-punctuation {
        font-size: 1.6rem;
    }
    
    .pinyin {
        font-size: 0.7rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
}

.references-section {
    padding: 0 20px;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.references-btn {
    background: #5c3e1e;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.references-btn:hover {
    background: #7a5438;
    transform: translateY(-2px);
}

.references-card {
    background: rgba(249, 243, 229, 0.95);
    border: 1px solid #e0d5c0;
    border-radius: 8px;
    padding: 25px;
    margin-top: 15px;
    display: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 700px;
    transition: all 0.4s ease;
    transform-origin: top;
}

.references-card.active {
    display: block;
    animation: slideDown 0.5s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.references-card h3 {
    color: #8B0000;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
    padding-bottom: 12px;
    border-bottom: 2px solid #d9c7a6;
    font-weight: normal;
}

.references-card ul {
    padding-left: 30px;
    list-style-type: none;
}

.references-card li {
    margin-bottom: 15px;
    line-height: 1.7;
    font-size: 1.05rem;
    position: relative;
    padding-left: 25px;
    color: #5c3e1e;
}

.references-card li:before {
    content: "•";
    color: #8B0000;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -3px;
}

.references-card li:last-child {
    margin-bottom: 0;
}